package com.hly.utils.B;

import com.hly.utils.Common.Config;
import com.hly.utils.Common.Context;
import com.hly.utils.Main.BaseMessage;
import com.hly.utils.Main.IMessageListener;
import com.hly.utils.Main.IStatusListener;
import com.hly.utils.Main.JPushCore;

public class BCall {


    private static Context context = new Context();

    public static void main(String[] args) {
        new Thread() {
            @Override
            public void run() {
                int count = 1;
                while (!Config.authStatus) {
                    try {
                        Thread.sleep(1000);
                        count++;
                        if (count == 5) {
                            System.out.println("用户确认了授权");
                            Config.authStatus = true;
                        }
                    } catch (Exception e) {
                    }
                }
            }
        }.start();
        BCore bCore = new BCore();
        JPushCore.register(context, bCore, new IStatusListener() {
            @Override
            public void onNotifyStatus(int status, boolean state, Object arg) {
                System.out.println("B收到通知:状态栏状态:" + status);
            }

            @Override
            public void onConnectStatus(int status, boolean state, Object arg) {
                System.out.println("B收到通知:连接状态:" + status);
            }
        }, new IMessageListener() {
            @Override
            public void onClickNotify(BaseMessage message) {
                System.out.println("B收到通知:点击通知栏:" + message);
            }

            @Override
            public void onMessageEvent(BaseMessage message) {
                System.out.println("B收到通知:消息接收:" + message);
            }
        });
    }
}
